function [ber_2,ber_4,ber_8]=homework2plotting_part1()

largenumber=15;
%power=100;	
power=[1 4 7 10 13 16 20 25];
noise=1;	
correl1=.3;
correl2=.3;
training=[0];

largenumber=8;
antennas=[8];
for p=1:length(power)
ber=0;
for k=1:largenumber
	k
	ber=homework2(power(p),noise,correl1,correl2,antennas,training)+ber;
end
temp=1-ber/largenumber;
ber_8(p,:)=temp(:,:);
end
save assignment2data.mat;

largenumber=20;
antennas=[4];
for p=1:length(power)
ber=0;
for k=1:largenumber
	k
	ber=homework2(power(p),noise,correl1,correl2,antennas,training)+ber;
end
temp=1-ber/largenumber;
ber_4(p,:)=temp(:,:);
end
save assignment2data.mat;

antennas=[2];
for p=1:length(power)
ber=0;
for k=1:largenumber
	k
	ber=homework2(power(p),noise,correl1,correl2,antennas,training)+ber;
end
temp=1-ber/largenumber;
ber_2(p,:)=temp(:,:);
end

ber_2
ber_4
ber_8
save assignment2data.mat;

x=10*log10(power);
ber_real=ber_8;
figure;
plot(x,ber_real(:,1)','b.-',x,ber_real(:,2)','c.-',x,ber_real(:,3)','r.-',x,ber_real(:,4)','m.-');
ylabel('Bit Error Rate');
xlabel('SNR (dB)');
legend('Sphere Detection', 'Simple Cancellation', 'ZF Ordering', 'MMSE Nulling');
title('BER rate vs SNR(dB) for Correlated Fading with n=8');

figure;
plot(x,ber_real(:,5),'b.-',x,ber_real(:,6),'c.-',x,ber_real(:,7),'r.-',x,ber_real(:,8),'m.-');
ylabel('Bit Error Rate');
xlabel('SNR (dB)');
legend('Sphere Detection', 'Simple Cancellation', 'ZF Ordering', 'MMSE Nulling');
title('BER rate vs SNR(dB) for Independent Fading with n=8');

ber_real=ber_4;
figure;
plot(x,ber_real(:,1)','b.-',x,ber_real(:,2)','c.-',x,ber_real(:,3)','r.-',x,ber_real(:,4)','m.-');
ylabel('Bit Error Rate');
xlabel('SNR (dB)');
legend('Sphere Detection', 'Simple Cancellation', 'ZF Ordering', 'MMSE Nulling');
title('BER rate vs SNR(dB) for Correlated Fading with n=8');

figure;
plot(x,ber_real(:,5),'b.-',x,ber_real(:,6),'c.-',x,ber_real(:,7),'r.-',x,ber_real(:,8),'m.-');
ylabel('Bit Error Rate');
xlabel('SNR (dB)');
legend('Sphere Detection', 'Simple Cancellation', 'ZF Ordering', 'MMSE Nulling');
title('BER rate vs SNR(dB) for Independent Fading with n=4');

ber_real=ber_2;
figure;
plot(x,ber_real(:,1)','b.-',x,ber_real(:,2)','c.-',x,ber_real(:,3)','r.-',x,ber_real(:,4)','m.-');
ylabel('Bit Error Rate');
xlabel('SNR (dB)');
legend('Sphere Detection', 'Simple Cancellation', 'ZF Ordering', 'MMSE Nulling');
title('BER rate vs SNR(dB) for Correlated Fading with n=8');

figure;
plot(x,ber_real(:,5),'b.-',x,ber_real(:,6),'c.-',x,ber_real(:,7),'r.-',x,ber_real(:,8),'m.-');
ylabel('Bit Error Rate');
xlabel('SNR (dB)');
legend('Sphere Detection', 'Simple Cancellation', 'ZF Ordering', 'MMSE Nulling');
title('BER rate vs SNR(dB) for Independent Fading with n=2');

